<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查英文</title>
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
$(function(){
	var url = "http://www.google.com/dictionary/json?&sl=en&tl=zh&restrict=pr%2Cde&client=te&q="
    $("#sub").click(function(){
        var q = $("#ent").val();
        if(q!=""){
            url = url + q + "&callback=?";
            $.getJSON(url,function(data){
                $("#result_zh").empty();
                $("#result_en").empty();
                $("<span>").html("中文解释:").appendTo("#result_zh");
                $("<span>").html("英文解释:").appendTo("#result_en");
                $.each(data.primaries[0].entries[0].entries,function(i,element){
                    
                    $("<li>").html(element.terms[1].text).appendTo("#result_zh");
                    $("<li>").html(element.terms[0].text).appendTo("#result_en");
                });
            });
        }
    });

    
	
});

</script>
</head>
<body>

<input id="ent" />
<button id="sub">查询</button>
<div id="result_zh">

</div>
<div id="result_en">

</div>
</body>
</html>